merged pull requests 1296 and 1403