Fixed debugging bugs