fixed a typo
Fixed issues with RES detection, got rid of debug prints