check for error not equal nil to make it work with beta 6