improved button handling and checking
minor change