Well there isn't very much too your code and that is the only part doing the alignment so it'd be worth playing with.
Also note that if no enitty is picked then the camera will still be trying to align to the last picked command incorrectly.
Also note that if no enitty is picked then the camera will still be trying to align to the last picked command incorrectly.