Fixed bug with custom data; added tests