Corrected various small bugs, most of them are related to compatibility
issues