small changes, some bug fixes