Fixes issue1828

http://code.google.com/p/web2py/issues/detail?id=1828