added explicit cast from double to integer for retun value of ceil function.