Fixed a bug with handling of actions and made logging messages better.