Fix for #4 #5 #7