some changes made due to bugs