fixed some errors and added the wait_cursor function