Fixed some Errors

This will fix #1091