debugging and cleanup