Added error processing and error messages.

Added error processing in WindowsManager class. Also fixed some minor
bags.