got rid of several bugs