fixed some handling issues