works in debug mode