Fixed nullpointer occuring from implicit cast from Integer -> int -> Integer
(cherry picked from commit 932187b)