bug fixes for different return levels