[#1008] Catch ValueError when resource's size is not an int

Fixes #1008.
Merge branch '1009-ValueError-when-resource-size-is-not-an-int'