Additional Python protection and test cases